<?php
class itemAction extends apiAction
{
    public function _initialize() {
		parent::_initialize();
    }
	public function index() {
		//取出所有开启的 分类 并且排序
		$map['status'] = 1;
		$order = 'ordid asc';
		$field = 'id,name';
		$cat = D('daka_class_cat')->field($field)->where($map)->order($order)->select();
		
		//取出所有开启的 课堂 并且排序
		$order = 'ordid asc,time desc';
		$field = 'id,cname,content as img';
		
		foreach($cat as $key => $item){
			$map['cat_id'] = $item['id'];
			$map['id'] = array('neq',1);
			//由于分类较少,所以这里使用循环 查询数据库
			$cat[$key]['class_list'] = D('daka_class')->field($field)->where($map)->order($order)->select();
		}
		//dump($cat);die;
		$this->assign('list',$cat);
		$tmp_data = $this->fetch();
		//写入静态文件里面
		_tmp_write($tmp_data,'index.html');
		$this->display();
    }
	
}
